package com.ym.b2b.tags;

import com.ym.b2b.brand.service.EmBBrandService;
import com.ym.b2b.brand.sqlbean.EmBBrand;
import com.ym.b2b.tags.base.BaseTag;
import com.zc.commons.base.Result;
import com.zc.commons.spring.SpringContextHolder;

/**
 * @ClassName: BrandTags
 * @Description: 分类标签
 * @Author 唐小娟
 * @Date 2015年3月9日 上午12:03:23
 * @Modify
 * @CopyRight 信息化团队
 */
public class BrandTags extends BaseTag {

    private static final long serialVersionUID = 895777383599438520L;

    protected Long            brandId;
    private Integer           limitRow;

    public int doStartTag() {
        Result ret = new Result();
        EmBBrand emBBrand = new EmBBrand();
        emBBrand.setIsShow(1);
        emBBrand.setLimitRow(limitRow);
        emBBrand.setBrandId(brandId);
        EmBBrandService emBBrandService = SpringContextHolder.getBean("emBBrandService");
        emBBrand.setSearchFlag("tag");

        if (null != limitRow) {
            emBBrand.setCacheKey("key_" + limitRow);
        } else {
            emBBrand.setCacheKey("key_brand");
        }

        ret.putData("brandList", emBBrandService.searchEmBBrand(emBBrand));

        getPageContext().getRequest().setAttribute(getOutResponseAttrName(), ret);
        return EVAL_BODY_INCLUDE;
    }

    public Long getBrandId() {
        return brandId;
    }

    public void setBrandId(Long brandId) {
        this.brandId = brandId;
    }

    public Integer getLimitRow() {
        return limitRow;
    }

    public void setLimitRow(Integer limitRow) {
        this.limitRow = limitRow;
    }

}
